﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bigger.Base.Pipeline;
using Bigger.Base.Cache;
using Bigger.Web.Mvc;

namespace CJAtech.BBS.Web.Controllers
{
    public class BBSApiController : ApiMessageController
    {
        [HttpGet]
        [ActionName("ExecuteApi")]
        public ActionResult ExecuteApiGet(ApiPackage objApiPackage)
        {
            //todo：请在这里进行Api文档的过滤，或者在Api的属性IsExposured设置为true
            //return ApiProcessGet(objApiPackage, new ApiExposureProcessHandle());
            return ApiMessageConfig(objApiPackage, "MvcCommonApiMessageGet");
        }

        [HttpPost]
        [ActionName("ExecuteApi")]
        public ActionResult ExecuteApiPost(ApiPackage objApiPackage)
        {
            //todo：请在这里进行Api文档的过滤，或者在Api的属性IsExposured设置为true
            //return ApiProcessPost(objApiPackage, new ApiExposureProcessHandle());
            return ApiMessageConfig(objApiPackage, "MvcCommonApiMessagePost");
        }

        /// <summary>
        /// 类似于UpiService暴露的通用的接口的使用方式，不一样的是提供了缓存的输出
        /// </summary>
        /// <param name="objApiPackage"></param>
        /// <returns></returns>
        public ActionResult ExecuteApiCache(ApiPackage objApiPackage)
        {
            //todo：请在这里进行Api文档的过滤，或者在Api的属性IsExposured设置为true
            return ApiMessageConfig(objApiPackage, "MvcCommonCacheApiMessage");
        }
    }
}
